package com.lisp.algorithm.leetcode.q257;

public class Q257 {

	public static void main(String[] args) {
		
	}
	
	private static String path(TreeNode n, int key) {
		if(n.val == key) {
			return String.valueOf(n.val);
		}
		
		if(n.left != null) {
			String s = path(n.left, key);
			if(s != null) {
				return n.val + "->" + s;
			}
		}
		
		if(n.right != null) {
			String s = path(n.right, key);
			if(s != null) {
				return n.val + "->" + s;
			}
		}
		
		return null;
	}
}

class TreeNode {
	int val;
	TreeNode left;
	TreeNode right;
	TreeNode() {}
	TreeNode(int val) { this.val = val; }
	TreeNode(int val, TreeNode left, TreeNode right) {
		this.val = val;
		this.left = left;
		this.right = right;
	}
}